feat(ffi): let a host ask which moss it loaded - #21
Merged
Conversation
A host resolves the shared library by path at runtime, so an old library sitting next to a new host is an ordinary mistake — and its symptoms are transport bugs the host has no way to attribute. Nothing exposed the version: not the FFI, not GetMeshInfo. Moss_Version returns the build stamp. The release workflow passes -ldflags "-X main.buildVersion=<tag>"; anything built another way reports "dev" rather than claiming a version it cannot know. Callers should treat a missing symbol as "older than v0.8.17". New symbol only — no existing signature changes, so every current host keeps working untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A host resolves the shared library by path at runtime — mosh via
moss-runtime/, mosh-org via--moss-lib/MOSH_ORG_MOSS_LIB, the probe from the directory beside the binary. So an old library sitting next to a new host is an ordinary mistake, and its symptoms are transport bugs the host has no way to attribute to the library.Nothing exposed the version: not the FFI surface, not
GetMeshInfo.Moss_Versionreturns the build stamp as a C string (free withMoss_Free). The release workflow now passes-ldflags "-X main.buildVersion=<tag>"; anything built another way reports"dev"rather than claiming a version it cannot know. Callers should treat a missing symbol as "older than v0.8.17".New symbol only — no existing signature changes, so every current host keeps working untouched.
Tests
"dev", so a hand-built library never claims a release;c-sharedbuild — checked against the built artifact, not a test binary, because that is the only place the flag actually applies.The cgo-in-
_test.goroute is not available (Go rejects it outright), so the symbol's body is a one-line wrapper over the variable both tests pin.